package com.bhs.sansonglogistics.net;

import android.text.TextUtils;

import com.bhs.sansonglogistics.BuildConfig;
import com.bhs.sansonglogistics.base.MyApplication;
import com.bhs.sansonglogistics.utils.SharedPreferencesUtils;

public class Config {
    //adminsite/#/login
    public static String testUrl = "http://test.sansongkeji.com";//测试服务器
    public static String baseUrl = "http://saasdemo.sansongkeji.com";//正式服务器
    public static String agreementUrl = getUrl() + "/adminsite/#/agreement/";//协议

    public static String getUrl() {
        String urlType = SharedPreferencesUtils.getString(MyApplication.getContext(), "urlType");
        String url = null;
        if (TextUtils.isEmpty(urlType)) {
            url = BuildConfig.DEBUG ? testUrl : baseUrl;
        } else {
            if (urlType.equals("1")) {
                url = baseUrl;
            } else {
                url = testUrl;
            }
        }
        return url;
    }

    //用户协议
    public static String getUserProtocolUrl() {
        return agreementUrl + "userProtocol";
    }

    //入驻协议
    public static String getEnterUrl() {
        return agreementUrl + "enter";
    }

    //隐私协议
    public static String getPrivacyPolicyUrl() {
        return agreementUrl + "privacyPolicy";
    }

    //运输协议
    public static String getTransportationUrl() {
        return agreementUrl + "transportation";
    }

    //红包规则
    public static String getRedEnvelopeRule() {
        return agreementUrl + "logistics";
    }

    //会员协议
    public static String getMember() {
        return agreementUrl + "member";
    }

    //推广协议
    public static String getPromotion() {
        return agreementUrl + "promotion";
    }


    public static String getWssUrl() {
        String urlType = SharedPreferencesUtils.getString(MyApplication.getContext(), "urlType");
        String url = null;
        if (TextUtils.isEmpty(urlType)) {
            url = BuildConfig.DEBUG ? "wss://test.sansongkeji.com:8021" : "wss://saasdemo.sansongkeji.com:3021";
        } else {
            if (urlType.equals("1")) {
                url = "wss://saasdemo.sansongkeji.com:3021";
            } else {
                url = "wss://test.sansongkeji.com:8021";
            }
        }
        return url;
    }


}
